package com.example.rbac.dto;

import com.example.rbac.model.SysAcl;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.beans.BeanUtils;

import java.util.Comparator;

/**
 * @author XieLongzhen
 * @date 2019/2/12 14:21
 */
@Getter
@Setter
@ToString
public class AclDto extends SysAcl {
    /**
     * 是否默认选中
     */
    private boolean checked = false;

    /**
     * 是否有权限操作
     */
    private boolean hasAcl = false;

    public static AclDto adapt(SysAcl acl) {
        AclDto dto = new AclDto();
        BeanUtils.copyProperties(acl, dto);
        return dto;
    }

    public static final Comparator<AclDto> COMPARATOR = Comparator.comparingInt(AclDto::getSeq);
}
